#ifndef OLLAMACLIENT_H
#define OLLAMACLIENT_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QJsonDocument>
#include <QJsonObject>
#include <QByteArray>
#include <QVector>

class OllamaClient : public QObject
{
    Q_OBJECT

public:
    explicit OllamaClient(QObject *parent = nullptr);

    void askQuestion(const QString &question);
    void resetContext(); // 重置上下文

signals:
    void responseReceived(const QString &response);
    void streamDataReceived(const QString &data);
    void errorOccurred(const QString &error);

private slots:
    void onReplyFinished(QNetworkReply *reply);
    void onReadyRead();

private:
    QNetworkAccessManager *manager;
    QNetworkReply *currentReply;
    QVector<QString> context; // 存储上下文
};

#endif // OLLAMACLIENT_H
